from entity.fault import Fault
from utils.dbpools_utils import db_pool


def insert_fault_info(fault: Fault):
    sql = "INSERT INTO fault(fixer, duty, damage, lost, date) \
       VALUES ('%s', '%s', '%s', '%s', '%s')" % (fault.fixer, fault.duty, fault.damage, fault.lost, fault.date)
    db_pool.update_data(sql)


def show_fault_info():
    sql = "SELECT * FROM fault ORDER BY date DESC"
    return db_pool.fetch_data(sql)
